﻿@using TjZheng.Domain.DataEntity;
@{
    ViewBag.Title = "投票信息列表";
    Layout = "~/Views/Shared/_ListLayout.cshtml";
    if (TransferThreeID.IsNoNull())
    {
        CurrentButtonTool.AddItem(new ButtonItem { ButtonIcon = "icon-back", ButtonName = "返回", Execution = "Back()", Position = ButtonPosition.Top });
    }
    DbSetInfo objDbSetInfo = ViewBag.DbSetInfo as DbSetInfo;
}
@inherits CMSWebViewPage<object>
@section Head{

}
<div id="toolbar_votehead" class="datagrid-toolbar">
    @CurrentButtonTool.Create()
</div>
<table id="dg_votehead" data-options="url:'/bbs/voteinfo/listjson?SetId=@objDbSetInfo.SetId@(TransferThreeID.IsNoNull() ? "&ArticleID=" + TransferThreeID : "")',border:false,fit:true,fitColumns:true,toolbar:'#toolbar_votehead',singleSelect:true,pagination:true,pageSize:20">
    <thead>
        <tr>
            <th data-options="field:'ck',checkbox:true"></th>
            <th data-options="field:'VoteHeadID',width:88,align:'center'">投票标题ID</th>
            <th data-options="field:'ArticleID',width:40,align:'center'">投票文章ID</th>
            <th data-options="field:'VoteTitle',width:100,align:'center'">投票标题内容</th>
            <th data-options="field:'MaxCheckNum',width:40,align:'center'">最大投票数量</th>
            <th data-options="field:'CreateTime',width:50,formatter:JsonToDate,align:'center'">创建时间</th>
            <th data-options="field:'UpdateTime',width:50,formatter:JsonToDate,align:'center'">修改时间</th>
            <th data-options="field:'ContentType',width:40,formatter:FormatContentType,align:'center'">投票内容类型</th>
        </tr>
    </thead>
</table>
@section Bottom{
    <script type="text/javascript">
    var objBizDatagrid = new BizDatagrid('#dg_votehead');
    function Add() {
        objBizDatagrid.add("/bbs/voteinfo/editpage?ArticleID=@TransferThreeID&SetId=@objDbSetInfo.SetId");
    }
    function Edit() {
        var objRow = objBizDatagrid.selectRow();
        objBizDatagrid.edit("/bbs/voteinfo/editpage?VoteHeadID=" + objRow.VoteHeadID + "&SetId=@objDbSetInfo.SetId", "ArticleID", "ArticleID");
    }
    function Search() {
        objBizDatagrid.search('#fr_search_votehead', '/bbs/voteinfo/listjson?SetId=@objDbSetInfo.SetId');
    }
    function Delete() {
        objBizDatagrid.del('/bbs/voteinfo/delete?SetId=@objDbSetInfo.SetId', "VoteHeadID");
    }
    function Back() {
        TransferToUrl("/bbs/ArticleInfo/Index?SetId=@objDbSetInfo.SetId");
    }
        function FormatContentType(val, row) {
            var result = "";
            switch (val) {
                case 0:
                    result = "文字";
                    break;
                case 1:
                    result = "图片";
                    break;
                case 2:
                    result = "视频";
                    break;
                case 3:
                    result = "图片+文字";
                    break;
                case 4:
                    result = "视频+文字";
                    break;
            }
            return result;
        }
    </script>
}
